//***************************************************************************************
// MediaFrame is an Open Source streaming media platform in Java 
// which provides a fast, easy to implement and extremely small applet 
// that enables to view your audio/video content without having 
// to rely on external player applications or bulky plug-ins.
//
//--------------------------------------------------------------------------------------
//
// We changed a lot of code and added a lot of functionality.
// This includes, but not limited to, the following changes:
// 1. The project was renamed to MediaFrame;
// 2. The connection speed detection procedure was added;
// 3. The JavaScript API functions were added;
// 4. The pre and post image support functionality was added;
// 5. The ability to save movie into the local disk was added;
// 6. The inner buffer for a movie file was added;
// 7. The click-through functionality was added;    
// 8. The .zip files support was added;    
// 9. The realtime feedback agent functionality was added.    
// For the full list of the current functionality please visit the following web page:
// http://mediaframe.org/
//    
// 06 Jul 2002 - 19 Dec 2004 Konstantin Belous, Oleg Lebedev
//
//--------------------------------------------------------------------------------------
//
//								"Hufmann.java"
//
// This file contains VLC (Hufmann) decoder. Its data base are some arrays which
// logically constitute a binary tree.
//
// (see also: http://rnvs.informatik.tu-chemnitz.de/~ja/MPEG/HTML/imp_asp.html
//
// The first element is the node in zero case the second in 1 case. These 2 values are
// followed by one or more result values.
//
//--------------------------------------------------------------------------------------
//
//		Joerg Anders, TU Chemnitz, Fakultaet fuer Informatik, GERMANY
//		ja@informatik.tu-chemnitz.de
//
//
//--------------------------------------------------------------------------------------
//
// This program is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this
// program; (See "LICENSE.GPL"). If not, write to the Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
//--------------------------------------------------------------------------------------
//
// If the program runs as Java applet it isn't "interactive" in the sense of the GNU
// General Public License. So paragraph 2c doesn't apply.
//
//***************************************************************************************

package mediaframe.mpeg1;

/**
 * The <code>Huffmann</code> class represents VLC (Hufmann) decoder. 
 * It's data base are some arrays which logically constitute a binary tree.
 */
public class Huffmann {
	/** The input movie's data bit stream. */
	private io_tool mpeg_stream = null; // To avoid passing of the io_tool
										// on every decoder call the io_tool
										// is given to the constructor.
	/**
	 * Constructs a VLC (Hufmann) decoder and loads Huffman tables. 
	 * @param stream the input movie's data bit stream.
	 */
	Huffmann(io_tool stream) {			
		mpeg_stream = stream;

		for(int i = 0; i< 65536; i++) {

			int idx = 0, idx1 = 0, max_length = 15;

			while (idx != -1) {
				idx1 = idx;
				idx = ((i & (1 << max_length--)) != 0) ? tables.dct_coeff1[idx] : tables.dct_coeff0[idx]; // get next index
			}
		
			if(i >= 1024) {
				dct_coeff_val_tab2[i >> 8] = tables.dct_coeff_val[idx1];
				dct_coeff_len_tab2[i >> 8] = 16 - (14 - max_length);
			} else {	
				dct_coeff_val_tab1[i] = tables.dct_coeff_val[idx1];
				dct_coeff_len_tab1[i] = 16 - (14 - max_length);
			}
		
		}
	}

	/** The Huffman tables for decoding a bit stream. */
	public static final Tables tables = loadTables();

	// The following 2 constants must be public because they are referenced in "MPEG_scan"
	/** DCT_ESCAPE constanta (byte value) in a bit stream. */ 
	public static final int DCT_ESCAPE = 63;
	/** End of block constanta (byte value) in a bit stream. */ 
	public static final int EOB = 62;

	// The data base (see also: ISO 11172-2)
	// The tables must be public because they are referenced in "MPEG_video".

	/** The huffman tree (value part) for the DCT coefficients (huffman index 1...1024). */
	public static int dct_coeff_val_tab1[] = new int[1024];
	/** The huffman tree (length part) for the DCT coefficients (huffman index 1024..65535). */
	public static int dct_coeff_val_tab2[] = new int[256];

	/** The huffman tree (length part) for the DCT coefficients (huffman index 1...1024). */
	public static int dct_coeff_len_tab1[] = new int[1024];
	/** The huffman tree (length part) for the DCT coefficients (huffman index 1024..65535). */
	public static int dct_coeff_len_tab2[] = new int[256];

	/**
	 * The method "decode" is the VLC (Hufmann) decoder. It traverses the
	 * "tree" given as parameter till a NIL(-1) index occurs. It returns the decoded value(s). 
	 * The return type is an array because some VLCs refer to more than 1 result.
	 * @param max_length maximum amount of bits that could be readed from a stream to decode values.
	 * @param tab the huffman table for decoding bit stream.
	 * @return the decoded value(s).
	 * @exception InterruptedException raises if another process interrupts the current process.
	 * @exception EOFException raises if the end of the file has been reached.
	 */
	public final int[] decode(int max_length, int tab[][]) throws InterruptedException, java.io.EOFException {
		int idx = 0, idx1 = 0;
		max_length++;
		int mask = (1 << max_length);
		int bits = mpeg_stream.get_bits(max_length); // make sure that enough bits are 
							     // available
		while (idx != -1) {	// NIL ????
			idx1 = idx;
			mask >>>= 1;    // next bit
			// System.out.println("b: " + bits + " m: " + mask + " bm: " + (bits & mask));
			idx = ((bits & mask) != 0) ? tab[idx][1] : tab[idx][0]; // get next index
			max_length--;	// count the length
		}

		mpeg_stream.bit_pos += max_length + 1; // unget unused bits		
		return(tab[idx1]);
	}

	/**
	 * Decodes one AC coefficient from a bit stream.
	 * @return the decoded value.
	 * @exception InterruptedException raises if another process interrupts the current process.
	 * @exception EOFException raises if the end of the file has been reached.
	 */
	public final int decodeCoeff() throws InterruptedException, java.io.EOFException {

		int bits = mpeg_stream.get_bits(16);

		if(bits >= 1024) {

			mpeg_stream.bit_pos += dct_coeff_len_tab2[bits >> 8];
			return dct_coeff_val_tab2[bits >> 8];

		} else {

			mpeg_stream.bit_pos += dct_coeff_len_tab1[bits];
			return dct_coeff_val_tab1[bits];
		}
	}

	/**
	 * Loads a Huffman tables from a resource file.
	 * @return the Huffman tables which has been loaded.
	 */
	public static Tables loadTables() {
		Tables ret = null;
		try {
			java.io.InputStream is = Tables.class.getResourceAsStream("Tables.ser");

			ret = (Tables) mediaframe.mpeg1.audio.decoder.JavaLayerUtils.deserialize(is);
			is.close();

		} catch (Exception ex) {
			System.out.println(ex);
		}
		return ret;
	}

/*
	public static void main(String[] argc) {

	Tables tbl = new Tables();

	int macro_block_inc[][] = {
		{45, 1, 0}, {-1, -1, 1}, {-1, -1, 2}, {-1, -1, 3}, {-1, -1, 4}, {-1, -1, 5}, 
		{-1, -1, 6}, {-1, -1, 7}, {-1, -1, 8}, {-1, -1, 9}, {-1, -1, 10}, {-1, -1, 11}, 
		{-1, -1, 12}, {-1, -1, 13}, {-1, -1, 14}, {-1, -1, 15}, {-1, -1, 16}, {-1, -1, 17}, 
		{-1, -1, 18}, {-1, -1, 19}, {-1, -1, 20}, {-1, -1, 21}, {-1, -1, 22}, {-1, -1, 23}, 
		{-1, -1, 24}, {-1, -1, 25}, {-1, -1, 26}, {-1, -1, 27}, {-1, -1, 28}, {-1, -1, 29}, 
		{-1, -1, 30}, {-1, -1, 31}, {-1, -1, 32}, {-1, -1, 33}, {-1, -1, -1}, {-1, -1, -2}, 
		{23, 22, 0}, {47, 36, 0}, {37, 75, 0}, {38, 73, 0}, {39, 71, 0}, {52, 40, 0}, 
		{41, 67, 0}, {42, 65, 0}, {43, 64, 0}, {44, 63, 0}, {45, -1, 0}, {25, 24, 0}, 
		{27, 26, 0}, {53, 48, 0}, {55, 49, 0}, {-1, 50, 0}, {60, 51, 0}, {29, 28, 0}, 
		{31, 30, 0}, {56, 54, 0}, {33, 32, 0}, {-1, 34, 0}, {-1, 57, 0}, {62, 58, 0}, 
		{-1, 59, 0}, {35, -1, 0}, {61, -1, 0}, {3, 2, 0}, {5, 4, 0}, {7, 6, 0}, 
		{9, 8, 0}, {69, 66, 0}, {11, 10, 0}, {70, 68, 0}, {13, 12, 0}, {15, 14, 0}, 
		{17, 16, 0}, {74, 72, 0}, {19, 18, 0}, {21, 20, 0}  
	};

	int p_type_mb_type[][] = {
		{12, 1, 0, 0, 0, 0}, {-1, -1, 0, 1, 1, 0}, {-1, -1, 0, 0, 1, 0}, {-1, -1, 0, 1, 0, 0}, 
		{-1, -1, 0, 0, 0, 1}, {-1, -1, 1, 1, 1, 0}, {-1, -1, 1, 0, 1, 0}, {-1, -1, 1, 0, 0, 1}, 
		{-1, 7, 0, 0, 0, 0}, {8, 6, 0, 0, 0, 0}, {9, 14, 0, 0, 0, 0}, {10, 3, 0, 0, 0, 0}, 
		{11, 2, 0, 0, 0, 0}, {12, -1, 0, 0, 0, 0}, {5, 4, 0, 0, 0, 0}  
	};

	int b_type_mb_type[][] = {
		{16, 19, 0, 0, 0, 0, 0}, {-1, -1, 0, 1, 1, 0, 0}, {-1, -1, 0, 1, 1, 1, 0}, 
		{-1, -1, 0, 0, 1, 0, 0}, {-1, -1, 0, 0, 1, 1, 0}, {-1, -1, 0, 1, 0, 0, 0}, 
		{-1, -1, 0, 1, 0, 1, 0}, {-1, -1, 0, 0, 0, 0, 1}, {-1, -1, 1, 1, 1, 1, 0}, 
		{-1, -1, 1, 1, 0, 1, 0}, {-1, -1, 1, 0, 1, 1, 0}, {-1, -1, 1, 0, 0, 0, 1}, 
		{10, 9, 0, 0, 0, 0, 0}, {18, 12, 0, 0, 0, 0, 0}, {13, 22, 0, 0, 0, 0, 0}, 
		{14, 21, 0, 0, 0, 0, 0}, {15, 20, 0, 0, 0, 0, 0}, {16, 19, 0, 0, 0, 0, 0}, 
		{-1, 11, 0, 0, 0, 0, 0}, {1, 2, 0, 0, 0, 0, 0}, {3, 4, 0, 0, 0, 0, 0}, 
		{5, 6, 0, 0, 0, 0, 0}, {8, 7, 0, 0, 0, 0, 0}  
	};

	int motion_code[][] = {
		{43, 17, 0}, {-1, -1, -16}, {-1, -1, -15}, {-1, -1, -14}, {-1, -1, -13}, {-1, -1, -12}, 
		{-1, -1, -11}, {-1, -1, -10}, {-1, -1, -9}, {-1, -1, -8}, {-1, -1, -7}, {-1, -1, -6}, 
		{-1, -1, -5}, {-1, -1, -4}, {-1, -1, -3}, {-1, -1, -2}, {-1, -1, -1}, {-1, -1, 0}, 
		{-1, -1, 1}, {-1, -1, 2}, {-1, -1, 3}, {-1, -1, 4}, {-1, -1, 5}, {-1, -1, 6}, 
		{-1, -1, 7}, {-1, -1, 8}, {-1, -1, 9}, {-1, -1, 10}, {-1, -1, 11}, {-1, -1, 12}, 
		{-1, -1, 13}, {-1, -1, 14}, {-1, -1, 15}, {-1, -1, 16}, {33, 1, 0}, {34, 45, 0}, 
		{35, 47, 0}, {-1, 36, 0}, {-1, 37, 0}, {38, 53, 0}, {39, 62, 0}, {40, 65, 0}, 
		{41, 66, 0}, {42, 67, 0}, {43, -1, 0}, {32, 2, 0}, {31, 3, 0}, {46, 48, 0}, 
		{30, 4, 0}, {29, 5, 0}, {49, 54, 0}, {50, 55, 0}, {51, 57, 0}, {52, 59, 0}, 
		{28, 6, 0}, {27, 7, 0}, {26, 8, 0}, {56, 58, 0}, {25, 9, 0}, {24, 10, 0}, 
		{23, 11, 0}, {60, 63, 0}, {61, 64, 0}, {22, 12, 0}, {21, 13, 0}, {20, 14, 0}, 
		{19, 15, 0}, {18, 16, 0}  
	};

	int block_pattern[][] = {
		{71, 77, 0}, {-1, -1, 60}, {-1, -1, 4}, {-1, -1, 8}, {-1, -1, 16}, {-1, -1, 32}, 
		{-1, -1, 12}, {-1, -1, 48}, {-1, -1, 20}, {-1, -1, 40}, {-1, -1, 28}, {-1, -1, 44}, 
		{-1, -1, 52}, {-1, -1, 56}, {-1, -1, 1}, {-1, -1, 61}, {-1, -1, 2}, {-1, -1, 62}, 
		{-1, -1, 24}, {-1, -1, 36}, {-1, -1, 3}, {-1, -1, 63}, {-1, -1, 5}, {-1, -1, 9}, 
		{-1, -1, 17}, {-1, -1, 33}, {-1, -1, 6}, {-1, -1, 10}, {-1, -1, 18}, {-1, -1, 34}, 
		{-1, -1, 7}, {-1, -1, 11}, {-1, -1, 19}, {-1, -1, 35}, {-1, -1, 13}, {-1, -1, 49}, 
		{-1, -1, 21}, {-1, -1, 41}, {-1, -1, 14}, {-1, -1, 50}, {-1, -1, 22}, {-1, -1, 42}, 
		{-1, -1, 15}, {-1, -1, 51}, {-1, -1, 23}, {-1, -1, 43}, {-1, -1, 25}, {-1, -1, 37}, 
		{-1, -1, 26}, {-1, -1, 38}, {-1, -1, 29}, {-1, -1, 45}, {-1, -1, 53}, {-1, -1, 57}, 
		{-1, -1, 30}, {-1, -1, 46}, {-1, -1, 54}, {-1, -1, 58}, {-1, -1, 31}, {-1, -1, 47}, 
		{-1, -1, 55}, {-1, -1, 59}, {-1, -1, 27}, {-1, -1, 39}, {59, 58, 0}, {73, 64, 0}, 
		{75, 65, 0}, {66, 125, 0}, {67, 119, 0}, {68, 105, 0}, {69, 93, 0}, {70, 86, 0}, 
		{71, 77, 0}, {61, 60, 0}, {63, 62, 0}, {-1, 74, 0}, {78, 1, 0}, {80, 76, 0}, 
		{3, 2, 0}, {5, 4, 0}, {82, 79, 0}, {7, 6, 0}, {83, 81, 0}, {9, 8, 0}, 
		{11, 10, 0}, {87, 84, 0}, {89, 85, 0}, {13, 12, 0}, {15, 14, 0}, {90, 88, 0}, 
		{17, 16, 0}, {19, 18, 0}, {94, 91, 0}, {97, 92, 0}, {21, 20, 0}, {23, 22, 0}, 
		{98, 95, 0}, {100, 96, 0}, {25, 24, 0}, {27, 26, 0}, {101, 99, 0}, {29, 28, 0}, 
		{31, 30, 0}, {106, 102, 0}, {108, 103, 0}, {112, 104, 0}, {33, 32, 0}, {35, 34, 0}, 
		{109, 107, 0}, {37, 36, 0}, {39, 38, 0}, {113, 110, 0}, {115, 111, 0}, {41, 40, 0}, 
		{43, 42, 0}, {116, 114, 0}, {45, 44, 0}, {47, 46, 0}, {120, 117, 0}, {122, 118, 0}, 
		{49, 48, 0}, {51, 50, 0}, {123, 121, 0}, {53, 52, 0}, {55, 54, 0}, {126, 124, 0}, 
		{57, 56, 0}  
	};

	int dct_size_luminance[][] = {
		{18, 15, 0}, {-1, -1, 0}, {-1, -1, 1}, {-1, -1, 2}, {-1, -1, 3}, {-1, -1, 4}, 
		{-1, -1, 5}, {-1, -1, 6}, {-1, -1, 7}, {-1, -1, 8}, {9, -1, 0}, {8, 10, 0}, 
		{7, 11, 0}, {6, 12, 0}, {5, 13, 0}, {17, 14, 0}, {18, 15, 0}, {1, 4, 0}, 
		{2, 3, 0}  
	};

	int dct_size_crominance[][] = {
		{18, 16, 0}, {-1, -1, 0}, {-1, -1, 1}, {-1, -1, 2}, {-1, -1, 3}, {-1, -1, 4}, 
		{-1, -1, 5}, {-1, -1, 6}, {-1, -1, 7}, {-1, -1, 8}, {9, -1, 0}, {8, 10, 0}, 
		{7, 11, 0}, {6, 12, 0}, {5, 13, 0}, {4, 14, 0}, {3, 15, 0}, {18, 16, 0}, 
		{1, 2, 0}  
	};

	int dct_coeff0[] = {
		128, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, 130, 115, 116, -1, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 101, 102, 131, 103, 136, 134, 105, 107, 110, 140, 112, 1, 143, 4, 155, 144, 8, 9, 149, 12, 13, 152, 14, 18, 158, 157, 25, 156, 21, 24, 26, 166, 161, 27, 163, 31, 33, 40, 167, 172, 175, 35, 171, 41, 176, 174, 37, 46, 39, 178, 42, 49, 50, 186, 183, 189, 52, 54, 190, 192, 56, 58, 193, 60, 62, 196, 64, 67, 201, 203, 207, 69, 71, 204, 73, 75, 208, 210, 77, 79, 211, 81, 82, 212, 213, 218, 84, 219, 221, 86, 88, 222, 90, 92, 225, 94, 96};

	int dct_coeff1[] = {141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, 114, 132, 135, 117, 215, 200, 185, 170, 162, 17, 151, 148, 145, 142, 141, 100, 108, 137, 113, 133, 139, 104, 106, 109, 138, 111, 2, 3, 5, 6, 146, 7, 10, 147, 11, 15, 150, 16, 22, 153, 154, 19, 159, 20, 23, 28, 160, 164, 32, 165, 29, 30, 34, 180, 168, 169, 47, 177, 36, 173, 179, 44, 38, 43, 181, 45, 48, 65, 182, 195, 184, 51, 53, 187, 188, 55, 57, 191, 59, 61, 194, 63, 66, 197, 198, 199, 68, 70, 202, 72, 74, 205, 206, 76, 78, 209, 80, 97, 226, 224, 214, 83, 216, 217, 85, 87, 220, 89, 91, 223, 93, 95};

	int dct_coeff_val[] = {0x0, 0x3e3e, 0x100, 0x101, 0x200, 0x102, 0x300, 0x103, 0x104, 0x201, 0x105, 0x106, 0x107, 0x400, 0x202, 0x108, 0x109, 0x3f3f, 0x500, 0x600, 0x301, 0x203, 0x10a, 0x10b, 0x10c, 0x10d, 0x700, 0x401, 0x302, 0x204, 0x205, 0x10e, 0x10f, 0x110, 0x800, 0x900, 0xa00, 0xb00, 0x501, 0x402, 0x303, 0x304, 0x206, 0x207, 0x208, 0x111, 0x112, 0x113, 0x114, 0x115, 0xc00, 0xd00, 0xe00, 0xf00, 0x601, 0x701, 0x502, 0x403, 0x305, 0x209, 0x20a, 0x116, 0x117, 0x118, 0x119, 0x11a, 0x1000, 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1600, 0x1700, 0x1800, 0x1900, 0x1a00, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00, 0x2000, 0x2100, 0x2200, 0x2300, 0x2400, 0x2500, 0x2600, 0x2700, 0x2800, 0x801, 0x901, 0xa01, 0xb01, 0xc01, 0xd01, 0xe01, 0xf01, 0x1001, 0x1101, 0x1201, 0x306, 0x20b, 0x20c, 0x20d, 0x20e, 0x20f, 0x210, 0x11b, 0x11c, 0x11d, 0x11e, 0x11f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};


	tbl.macro_block_inc = macro_block_inc;

	tbl.p_type_mb_type = p_type_mb_type;

	tbl.b_type_mb_type = b_type_mb_type;

	tbl.motion_code = motion_code;

	tbl.block_pattern = block_pattern;

	tbl.dct_size_luminance = dct_size_luminance;

	tbl.dct_size_crominance = dct_size_crominance;

	tbl.dct_coeff0 = dct_coeff0;

	tbl.dct_coeff1 = dct_coeff1;

	tbl.dct_coeff_val = dct_coeff_val;

		try {
			java.io.FileOutputStream out = new java.io.FileOutputStream("Tables.ser");
			mediaframe.mpeg1.audio.decoder.JavaLayerUtils.serialize(out,tbl);
			out.close();
		} catch (Exception ex) { }
	}
*/	
}
